

def get_customize(rate,customize):
		res=list('0000000')
		if rate=='customize':
			for x in customize.split(','):
				res[int(x)-1]='1'
			res=''.join(res)
			return res
		else:
			return None

print(get_customize('customize','1'))


# ffmpeg -i 002.aac -acodec libmp3lame 2.mp3
# ffmpeg -i test03.mp3 -ac 1 -ar 8000 test03.amr



# from sqlalchemy import Column,String,Integer,create_engine
# from sqlalchemy.orm import sessionmaker
# from sqlalchemy.ext.declarative import declarative_base
# from sqlalchemy import desc
# from sqlalchemy.ext.automap import automap_base	
# from sqlalchemy.orm import Session
# from sqlalchemy import create_engine
# import datetime
# import json
# import math
# import time
# import redis,binascii,re
# # from compute.data_compute import *
# import numpy as np
# import pandas as pd
# import sys,requests

# import hashlib

# day = datetime.datetime.now().isoweekday()
# hour = datetime.datetime.now().hour
# minute = datetime.datetime.now().minute
# print(day,hour,minute)
# url='http://apilocate.amap.com/position?accesstype=1&imei=352315052834187&macs=f8:c3:9e:d6:6a:09,-57|d0:76:e7:0f:e3:b3,-66&key=0ff8329afe2ab4e379f6af1f555c86b7'
# url1='http://apilocate.amap.com/position?accesstype=0&imei=9613051350&cdma=0&bts=460,0,30752,28263,-10&nearbts=460,0,30752,28262,-3|460,0,30570,23153,2&key=0ff8329afe2ab4e379f6af1f555c86b7'
# url2='http://apilocate.amap.com/position?accesstype=0&imei=352315052834187&smac=E0:DB:55:E4:C7:49&cdma=1&bts=13824,1,1838,-52&key=0ff8329afe2ab4e379f6af1f555c86b7'
# res=requests.get(url)
# comd_log=dict(command_id='comd_id',
# 					device_id='dev_id',
# 					command_name='commd',
# 					command_style='commd',
# 					command_value ='value',
# 					sent_time='send_time',
# 					owner='owner')
# print(comd_log)
# now_time=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
# mon_start=now_time.split(' ')
# day_start=mon_start[0].split('-')
# mon_start[1]='00:00:00'
# day_start[2]='01'
# mon_start[0]='-'.join(day_start)
# mon_start=' '.join(mon_start)
# print('voice' in b'dkfjdsdj')
# def send_sms(Verification,phone,time):
# 	"""发送短信验证码"""
# 	random = Verification
# 	sigsdata = 'appkey=a646ca2f3eeec4cf8ff5bcd031f4d23b&random='+random+'&time=' + time + '&mobile=' + phone
# 	hash  = hashlib.sha256()
# 	hash.update(sigsdata.encode("utf8"))
# 	sigs = hash.hexdigest()
# 	url = "https://yun.tim.qq.com/v5/tlssmssvr/sendsms?sdkappid=1400305225&random=" + random
# 	print('url---',url)
# 	data ={
# 		'ext':'',
# 		'extend':'',
# 		'params':[Verification,'2'],
# 		'sig':sigs,
# 		'sign':'深圳简易通科技',
# 		'tel':{
# 			'mobile':phone,
# 			'nationcode':'86',
# 		},
# 		'time':time,
# 		'tpl_id':'518930'
# 	}
# 	data = json.dumps(data)
# 	wifi_loca = requests.post(url,data)
# 	return wifi_loca.text
# now_time = str(int(time.time()))
# send_sms('112554','18126051205',now_time)
# url='http://api.heclouds.com/devices/612338342'
# url='http://api.heclouds.com/devices/612338342/datapoints'
# url="http://api.heclouds.com/devices/612338342/lbs/getWifiTrail"
# headers = {
#    'api-key':'cjCIKAieKZljPpsBij7IWIsx9xs='
# }

# data={ "datastreams": [{
#             "id": "$OneNET_LBS_WIFI",
#             "datapoints": [{
#             		'at':'2019-07-23T12:00:00',
#                     "value":{
#                                 "macs":"f8:c3:9e:d6:6a:09,-57|d0:76:e7:0f:e3:b3,-66",
#                                 "mmac":"f8:c3:9e:d6:6a:09,-57",
                                
#                                             }}
                
#             ]
#         }]}

# "FC:D7:33:55:92:6A,-77|B8:F8:83:E6:24:DF,-60",

# data=json.dumps(data)
# res=requests.post(url,data,headers=headers)
# res=requests.get(url,headers=headers)
# print(res.text)
# import urllib
# import urllib.request
# import json
# serviceurl = 'http://maps.googleapis.com/maps/api/geocode/json?'
#serviceurl = 'http://python-data.dr-chuck.net/geojson?'

# while True:
#     address = input('Enter location:')
#     if len(address) < 1:break
#     url = serviceurl + urllib.parse.urlencode({'sensor':'false','address':address})
#     print('Retrieving:',url)
#     uh = urllib.request.urlopen(url)
#     data = uh.read()
#     print('Retrieved:',len(data),'characters')

#     print(str(data))
#     #接受过来的数据都是字节型数据需要进行decode（）操作
#     try: js = json.loads(data.decode())
#     except: js = None
# #try:js = json.loads(str(data))
#     #except: js = None
#     print(js)
#     if 'status' not in js or js['status'] != 'OK':
#         print('===Failed To Retrieve===')
#         print(data)
#         continue
#     print(json.dumps(js,indent=4))

#     lat = js['results'][0]['geometry']['location']['lat']
#     lng = js['results'][0]['geometry']['location']['lng']
#     print('lat:',lat,'lng:',lng)
#     location = js['results'][0]['formatted_address']
#     print(location)

# url = "http://www.google.com/loc/json"
# print('url---',url)
# data ={"cell_towers":{'cell_id':25070,
# 	'location_area_code':4474,
# 	'mobile_country_code':460,
# 	'mobile_network_code':0},
# 	"version":"1.1.0",
# 	"host":"maps.google.com",
# 	"address_language":"zh_CN",
# 	"request_address":True
# 	}
# data = json.dumps(data)
# wifi_loca = requests.post(url,data)
# print(wifi_loca)

# title_dict={'send_rate':'IWBP33','health_rate':'IWBP86',
# 			'sos1':'IWBP12','sos2':'IWBP12','sos3':'IWBP12','sos':'IWBP12',
# 			'step_cunt_btn':'IWBP21','walk_time_set':'WALKTIME',
# 			'silence_time_set':'SILENCETIME','time_remind':'IWBP81','work_model':'IWBP33'}

# title_list={'call_now':'IWBP16','factory_set':'IWBP17','dev_reset':'IWBP18','turn_off_dev':'IWBP31','find_dev':'FIND',
# 			'heart_rate_detect':'IWBPXL','blood_pres_detect':'IWBPXY','health_detect':'IWBPXY'}
# d1={}
# def get_com(dd):
# 	for x in dd:
# 		d1[dd[x]]=x
# get_com(title_dict)
# get_com(title_list)
# print(d1)
# sys.getsizeof(b'#!')
# param=b'2ekfjdsklnlsfuwerfjsdknvdsho;weufpewjfnldnvdlsjhfoweurperuewofhdiskvnvbnwso;uy498r7ueinvdsvjsdhwe8rqefh'
# textArr = re.findall(b'.{24}', param)
# textArr.append(param[(len(textArr)*24):])
# cut_result=pd.DataFrame(textArr).to_dict()[0]
# print(b'#!\xfecy:',binascii.hexlify(b'#!\xfecy:')[2])

# ddd=bytes.fromhex('2321fe63793a')
# print(ddd)
# timeArray = time.strptime("2014-12-31 18:20:10", "%Y-%m-%d %H:%M:%S")
# print(timeArray.tm_mday)

#导入数据库映射，表示用sqlachemy操作django的model创建的数据库
#连接django在使用的postgresql数据库
# Base = automap_base()
# engine = create_engine('postgres://postgres:123456@localhost:5432/tracker')	
# Base.prepare(engine, reflect=True)	
# da=b'\x08\x10y\xa09\x14a'
# da=binascii.hexlify(da).decode()
# import base64
# da=base64.b64encode(da)
# data='你好'.encode('gbk')
# data=binascii.hexlify(data)
# print(data)

# dre=''
# for x in 'demo':
# 	res=hex(ord(x))[2:]
# 	dre+=res
# print(dre.encode('gbk'))
# #建立数据库映射
# Device=Base.classes.tracker_app_device
# session = Session(engine)
# #连接REDIS
# pool_redis= redis.ConnectionPool(host='localhost',port=6379,decode_responses=True)
# mesg_redis=redis.Redis(connection_pool=pool_redis)

# for x in [1,2,3,4,5,6]:
# 	mesg_redis.rpush('redistest',str(x))


# get_data=mesg_redis.lrange('redistest',0,-1)
# print('get_data===>',get_data)

# mesg_redis.rpush('redistest',str(7))
# mesg_redis.rpush('redistest',str(8))

# mesg_redis.ltrim('redistest',len(get_data),-1)

# dd=mesg_redis.lrange('redistest',0,-1)
# print('dd===>',dd)
# mesg_redis.ltrim('redistest',len(get_data),-1)
# dd=mesg_redis.lrange('redistest',0,-1)
# print('dd===>',dd)
# while True:
# 	ddd=mesg_redis.rpop('redistest')
# 	print(ddd)
# 	if ddd==None:
# 		break

# df=pd.DataFrame(np.arange(9).reshape(3,3),index=['ind0','ind1','ind2'],columns=['苹果','橙子','草莓'])
# df['苹果']=[{1:0,2:0,3:0},{1:0,2:0,3:0},{1:0,2:0,3:0}].copy()
# df['香蕉']=df['苹果'].copy()
# df.reset_index(drop=False)
# df.apply(lambda x:x['苹果'].clear(),axis=1)
# print(df)
#数据存库字段
# field_name=['device_id','lng','lat','lbs','wifi',
# 			'rssi','heart_rate','blood_pres','step_count',
# 			'obd','track_type','speed','dirct','status',
# 			'battery','sos_alarm','dev_upload','serv_receive','hard_verson',
# 			'mileage','oil_use','efence_alarm','speed_alarm','stop_time',
# 			'location','othermesg','scanner','remark','heart_alarm','blood_alarm']

# d1={}
# d2={}
# for x in field_name:
# 	d1[x]='0'
# 	d2[x]='0'


# ded=['123464','123467','123459','123468','8888888','123461','123469','110','67890']
# data={}
# datalint=[]
# for x in ded:
# 	data['device_id']=x
# 	data['iccid']='880'
	# data['111111111111iccid']='880'
	# datalint.append(data)
	# print(data)
	# datalint.append(Base.classes[x](**data))

# print(engine.table_names())


# session.add_all(datalint)
# session.commit()
# session.bulk_update_mappings(Device,datalint)
#提交更新的数据
# session.commit()


# sql_device = 'select * from tracker_app_device'
# device = pd.read_sql_query(sql_device,engine)
# device=device.loc[device['device_id'].isin(ded)]
# device['iccid']=device['iccid'].map(lambda x:'xxxxxxxxxxxxxxxxxxxxx')
# device['iccid8888888']=device['iccid'].map(lambda x:'5555555555555555550')
# device_to_db=json.loads(device.to_json(orient="records",force_ascii=False))

# session.bulk_update_mappings(Device,device_to_db)
# # 提交更新的数据
# session.commit()
# print(vars(session.query(Base.classes['8888888']).filter(Base.classes['8888888'].id==100).first()))




# {'id': 4168, 'terminal_id': '862459148127315', 'common_data': '0', 'name': '862459148127315', 'tag_id': '0', 'iccid': '0', 'model': 'rbygps', 'manufacturer': '0', 'device_set': '0', 'receive_port': "[20001, 'rbygps']", 'raw_data': "{'event': 'low_voltage_alarm', 'date': '2020-6-17 19:26:48', 'clock': 11536, 'mesg_num': '16'}", 'remark': '0', 'create_time': '2020-06-17 11:39:41', 'modify_time': '2020-06-17 21:46:15'}


# now=int(time.time())
# oldt=time.mktime(time.strptime('2020-06-29 22:00:26','%Y-%m-%d %H:%M:%S'))
# print(now-oldt,oldt,now)

# import base64
# da=base64.b64decode(vd)
# print(da)

